package test;

import javax.validation.constraints.Max;

public class atio {
    public static void main(String[] args) {

        System.out.println(Myatio("  +-234"));
    }
    public static int Myatio(String s){
        char[] tar = s.toCharArray();
        int length = tar.length;
        int index = 0;
        while (index<length &&tar[index]==' '){
            index++;
            System.out.println(index);
        }
        if (index>length){
            System.out.println("ce");
            return 0;
        }
        int singn = 1;
        do{if(tar[index]=='-'||tar[index]=='+'){
            if(tar[index]=='-'){
                singn = -1;
            }
            index++;
        }}while (tar[index]=='-'||tar[index]=='+');
        int result = 0;
        int tem = 0;
        while (index<length){
            int num = tar[index]-'0';
            if (num>9||num<0){
                break;
            }
            tem = result;
            result = result * 10 +num;
            if(result/10 != tem){
                if (singn>0){
                    return Integer.MAX_VALUE;
                }else{
                    return Integer.MIN_VALUE;
                }
            }
            index++;
        }
        return result*singn;
    }
}
